import {
    reqCategoryList,
    reqGetBannerList
} from '@/api'
// Home 仓库存储数据的地方
const state = {
    categoryList: [],
}
const mutations = {
    CATEGORYLIST(state, categoryList) {
        state.categoryList = categoryList
    },
    GETBANNERLIST(state, bannerList) {
        state.bannerList = bannerList
    }
}
const actions = {
    async categoryList({
        commit
    }) {
        let result = await reqCategoryList()
        if (result.code === 200) {
            commit("CATEGORYLIST", result.data)
        }
    },
    // 获取首页轮播图
    async getBannerList({
        commit
    }) {
        let result = await reqGetBannerList();
        if (result.code === 200) {
            commit("GETBANNERLIST", result.data)
        }
    }
}
const getters = {}

export default {
    state,
    mutations,
    actions,
    getters
}